@using BTCPayServer.Client
@using BTCPayServer.Views.Stores
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model BTCPayServer.PayoutProcessors.OnChain.UIOnChainAutomatedPayoutProcessorsController.OnChainTransferViewModel
@{
    var storeId = Context.GetStoreData().Id;
    var cryptoCode = Context.GetRouteValue("cryptocode")?.ToString();
    ViewData.SetLayoutModel(new(nameof(StoreNavPages.PayoutProcessors), StringLocalizer["On-Chain Payout Processor"]));
}

<form method="post" permissioned="@Policies.CanModifyStoreSettings">
    <div class="sticky-header">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a asp-controller="UIPayoutProcessors" asp-action="ConfigureStorePayoutProcessors" asp-route-storeId="@storeId" text-translate="true">Payout Processors</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">@ViewData["Title"]</li>
            </ol>
            <h2>@ViewData["Title"]</h2>
        </nav>
		<button id="page-primary" name="command" type="submit" class="btn btn-primary" value="Save" text-translate="true">Save</button>
    </div>
    <partial name="_StatusMessage" />
    <div class="row">
        <div class="col-xl-8 col-xxl-constrain">
            <p text-translate="true">Set a schedule for automated On-Chain Bitcoin Payouts.</p>
            @if (!ViewContext.ModelState.IsValid)
            {
                <div asp-validation-summary="All"></div>
            }
            <div class="d-flex my-3">
                <input asp-for="ProcessNewPayoutsInstantly" type="checkbox" class="btcpay-toggle me-3" />
                <label asp-for="ProcessNewPayoutsInstantly" class="form-check-label"></label>
                <span asp-validation-for="ProcessNewPayoutsInstantly" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="IntervalMinutes" class="form-label" data-required text-translate="true">Interval</label>
                <div class="input-group">
                    <input asp-for="IntervalMinutes" class="form-control" inputmode="numeric" style="max-width:12ch;">
                    <span class="input-group-text" text-translate="true">minutes</span>
                    <span asp-validation-for="IntervalMinutes" class="text-danger"></span>
                </div>
            </div>
            <div class="form-group">
                <label asp-for="FeeTargetBlock" class="form-label" data-required text-translate="true">Fee block target</label>
                <div class="input-group">
                    <input asp-for="FeeTargetBlock" class="form-control" min="1" inputmode="numeric" style="max-width:12ch;">
                    <span class="input-group-text" text-translate="true">blocks</span>
                    <span asp-validation-for="FeeTargetBlock" class="text-danger"></span>
                </div>
            </div>
            <div class="form-group">
                <label asp-for="Threshold" class="form-label" data-required text-translate="true">Threshold</label>
                <div class="input-group">
                    <input asp-for="Threshold" class="form-control" min="0" inputmode="numeric" style="max-width:12ch;">
                    <span class="input-group-text">@cryptoCode</span>
                    <span asp-validation-for="FeeTargetBlock" class="text-danger"></span>
                </div>
                <div class="form-text" text-translate="true">Only process payouts when this payout sum is reached.</div>
            </div>
        </div>
    </div>
</form>

@section PageFootContent {
    <partial name="_ValidationScriptsPartial" />
}
